package com.baidu.ota.model;

import com.baidu.commonlib.interfaces.ICheckUpdateListener;
import com.baidu.commonlib.interfaces.IDownloadListenerEx;
import com.baidu.commonlib.interfaces.IOtaAgent;
import com.baidu.commonlib.interfaces.IUpgradeListener;

public class OtaModelImpl implements IOtaModel {

    private final IOtaAgent agent;

    public OtaModelImpl(IOtaAgent agent) {
        this.agent = agent;
    }

    @Override
    public void checkUpdate(ICheckUpdateListener l) {
        agent.checkUpdate(false, l);
    }

    @Override
    public void download(String pkgName, IDownloadListenerEx l) {
        agent.downLoad(pkgName, l);
    }

    @Override
    public void cancelDownload(String pkgName) {
        agent.downLoadAbort(pkgName);
    }

    @Override
    public void upgrade(String pkgName, IUpgradeListener l) {
        agent.upgrade(pkgName, l);
    }
}
